package com.kaiwukj.android.ufamily.mvp.ui.page.dynamic;

import com.kaiwukj.android.mcas.mvp.IModel;
import com.kaiwukj.android.mcas.mvp.IView;
import com.kaiwukj.android.ufamily.mvp.http.entity.base.ListResp;
import com.kaiwukj.android.ufamily.mvp.http.entity.params.CommentParams;
import com.kaiwukj.android.ufamily.mvp.http.entity.params.CommentReplyParams;
import com.kaiwukj.android.ufamily.mvp.http.entity.params.DynamicListParams;
import com.kaiwukj.android.ufamily.mvp.http.entity.params.DynamicPubParams;
import com.kaiwukj.android.ufamily.mvp.http.entity.params.UserInfoParams;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.AboutGoodsResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.CommentResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.DynamicReportTypeResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.DynamicResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.FansResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.ShieldResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.TopicResult;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.UserResult;

import java.util.List;

import io.reactivex.Observable;

public interface DynamicContract {

    interface View extends IView {

        void onFetchDynamic(List<DynamicResult> results);

        void onGetDynamic(DynamicResult result);

        /**
         * 获取评论
         *
         * @param results results
         * @param isChild 是否是子评论
         */
        void onGetComment(List<CommentResult> results, boolean isChild);

        void onCommentResult(int id, CommentParams params);

        void onReplyResult(int parentPos, int id, CommentReplyParams params);

    }

    interface PersonIndexView extends IView {
        void onGetPersonDynamic(List<DynamicResult> circleHomeResults);

        void onGetPersonInfo(UserResult result);

    }

    interface PublishView extends IView {

    }

    interface ReportView extends IView {
        void onFetchReportView(List<DynamicReportTypeResult> results);

        void onFetchShieldList(List<ShieldResult> results);
    }

    interface TopicView extends IView {
        void onFetchTopic(List<TopicResult> results);

        void onTopicAdd(Integer topicId);

        void onGetTopic(TopicResult result);

        void onTopicGroupJoin(String hxGroupId);

    }

    interface FansView extends IView {
        void onFetchFans(List<FansResult> results, int totalCount);
    }

    interface AboutView extends IView {
        void onFetchAboutComment(List<AboutGoodsResult> results);
    }

    interface Model extends IModel {

        Observable<UserResult> fetchPersonIndexInfo(int userId);

        Observable<ListResp<DynamicResult>> fetchDynamic(DynamicListParams params);

        Observable<ListResp<DynamicResult>> fetchTopicDynamic(DynamicListParams params);

        Observable<DynamicResult> getDynamicById(int id);

        /**
         * 获取动态评论
         *
         * @param dynamicId 动态Id
         * @param startId   当前页最后一项的评论Id
         * @param pageSize  pageSize
         * @return
         */
        Observable<ListResp<CommentResult>> fetchComment(int dynamicId, int startId, int pageSize);

        //获取二级评论
        Observable<ListResp<CommentResult>> fetchReply(int commentId, int startId, int pageSize);

        Observable<Integer> delDynamic(int dynamicId);

        Observable<Integer> comment(CommentParams params);

        Observable<Integer> commentReply(CommentReplyParams params);

        /**
         * 删除评论
         *
         * @param type 0:主评论 1:子评论
         * @param id   主键
         * @return result
         */
        Observable<Integer> delComment(int type, int id);

        /**
         * 关注
         *
         * @param id 用户Id
         * @return code
         */
        Observable<Integer> attention(int id);

        /**
         * 取消关注
         *
         * @param id 用户Id
         * @return code
         */
        Observable<Integer> cancelAttention(int id);

        /**
         * 点赞
         *
         * @param id 动态Id
         * @return code
         */
        Observable<Integer> praise(int id);

        /**
         * 取消点赞
         *
         * @param id 动态Id
         * @return code
         */
        Observable<Integer> cancelPraise(int id);

        Observable<Integer> report(int dynamicId, int reportTypeId);

        Observable<List<DynamicReportTypeResult>> fetchReportType();

        /**
         * 屏蔽
         *
         * @param uId   userId
         * @param block statusFlag
         * @param user  是用户
         * @return code
         */
        Observable<Integer> shield(int uId, boolean block, boolean user);

        Observable<Integer> publishDynamic(DynamicPubParams params);

        Observable<String> getQiNiuToken();

        Observable<ListResp<TopicResult>> fetchTopic(String keyword);

        Observable<Integer> addTopic(String topicTitle);

        Observable<TopicResult> getTopicById(int id);

        Observable<String> joinGroup(String groupId);

        Observable<ListResp<FansResult>> fetchFansResult(int userId, int startId, int pageSize);

        Observable<ListResp<FansResult>> fetchAttentionResult(int userId, int startId, int pageSize);

        //获取与我相关点赞
        Observable<ListResp<AboutGoodsResult>> fetchAboutGoodsResult(int page, int pageSize);

        //获取与我相关评论
        Observable<ListResp<AboutGoodsResult>> fetchAboutCommentResult(int page, int pageSize);

        //获取与我相关关注
        Observable<ListResp<AboutGoodsResult>> fetchAboutFansResult(int page, int pageSize);

        Observable<ListResp<ShieldResult>> fetchShieldList(int page, int pageSize);

        //更新用户信息
        Observable<Integer> updateUserInfo(UserInfoParams params);

    }

}
